load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "fileserver",
    srcs = ["fileserver.go"],
    embedsrcs = [
        "templates/directory-listing-footer.html",
        "templates/directory-listing-header.html",
        "templates/directory-listing-row.html",
        "templates/error.html",
    ],
    importpath = "github.com/pachyderm/pachyderm/v2/src/internal/fileserver",
    visibility = ["//src:__subpackages__"],
    deps = [
        "//src/constants",
        "//src/internal/client",
        "//src/internal/conditionalrequest",
        "//src/internal/log",
        "//src/internal/middleware/auth/httpauth",
        "//src/internal/pctx",
        "//src/internal/uuid",
        "//src/pfs",
        "@com_github_dustin_go_humanize//:go-humanize",
        "@com_github_timewasted_go_accept_headers//:go-accept-headers",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//status",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "fileserver_test",
    size = "small",
    srcs = ["fileserver_test.go"],
    pure = "on",
    deps = [
        ":fileserver",
        "//src/auth",
        "//src/constants",
        "//src/internal/client",
        "//src/internal/cmputil",
        "//src/internal/dockertestenv",
        "//src/internal/pctx",
        "//src/internal/testpachd/realenv",
        "//src/internal/testutil",
        "//src/pfs",
        "@com_github_google_go_cmp//cmp",
        "@org_golang_google_protobuf//types/known/wrapperspb",
    ],
)
